package game;
import java.util.ArrayList;
import java.util.List;

import fields.Brewery;
import fields.Field;
import fields.Jail;
import fields.Parking;
import fields.Refuge;
import fields.Ships;
import fields.Start;
import fields.Tax;
import fields.Territory;
import fields.TryYourLuck;

public class Gameboard {
	
	private Field[] fieldlist;
	private LuckyCardStack luckycards;
	
	public Gameboard()
	{
		luckycards = new LuckyCardStack();
		fieldlist     = new Field[40];
		fieldlist[0] = new Start(1, "Start");
		fieldlist[1] = new Territory(2, "Rødovrevej", 1200, new int[]{50,250,750,2250,4000,6000}, 2, 1000, "Blue");
		fieldlist[2] = new TryYourLuck(3, "Try Your Luck", luckycards);
		fieldlist[3] = new Territory(4, "Hvidovrevej", 1200, new int[]{50,250,750,2250,4000,6000}, 2, 1000, "Blue");
		fieldlist[4] = new Tax(5, "Indkomstskat", 4000);
		fieldlist[5] = new Ships(6, "SFL-færgerne", 4000);
		fieldlist[6] = new Territory(7, "Roskildevej", 2000, new int[]{100,600,1800,5400,8000,11000}, 3, 1000, "Pink");
		fieldlist[7] = new TryYourLuck(8, "Try Your Luck", luckycards);
		fieldlist[8] = new Territory(9, "Valby Langgade", 2000, new int[]{100,600,1800,5400,8000,11000}, 3, 1000, "Pink");
		fieldlist[9] = new Territory(10, "Allégade", 2400, new int[]{150,800,2000,6000,9000,12000}, 3, 1000, "Pink");
		fieldlist[10] = new Refuge(11, "Jail Visit", 0);
		fieldlist[11] = new Territory(12, "Frederiksberg Allé", 2800, new int[]{200,1000,3000,9000,12500,15000}, 3, 2000, "Green");
		fieldlist[12] = new Brewery(13, "Tuborg", 3000);
		fieldlist[13] = new Territory(14, "Bülowsvej", 2800, new int[]{200,1000,3000,9000,12500,15000}, 3, 2000, "Green");
		fieldlist[14] = new Territory(15, "Gl. Kongevej", 3200, new int[]{250,1250,3750,10000,14000,18000}, 3, 2000, "Green");
		fieldlist[15] = new Ships(16, "DSB Kalundborg/Århus", 4000);
		fieldlist[16] = new Territory(17, "Bernstorffsvej", 3600, new int[]{300,1400,4000,11000,15000,19000}, 3, 2000, "Grey");
		fieldlist[17] = new TryYourLuck(18, "Try Your Luck", luckycards);
		fieldlist[18] = new Territory(19, "Hellerupvej", 3600, new int[]{300, 1400,4000,11000,15000,19000}, 3, 2000, "Grey");
		fieldlist[19] = new Territory(20, "Strandvej", 4000, new int[]{350,1600,4400,12000,16000,20000}, 3, 2000, "Grey");
		fieldlist[20] = new Parking(21, "Parking");
	 	fieldlist[21] = new Territory(22, "Trianglen", 4400, new int[]{350,1800,5000,14000,17500,21000}, 3, 3000, "Red");
	 	fieldlist[22] = new TryYourLuck(23, "Try Your Luck", luckycards);
	 	fieldlist[23] = new Territory(24, "Østerbrogade", 4400, new int[]{350,1800,5000,14000,17500,21000}, 3, 3000, "Red");
	 	fieldlist[24] = new Territory(25, "Grønningen", 4800, new int[]{400,2000,6000,15000,18500,22000}, 3, 3000, "Red");
	 	fieldlist[25] = new Ships(26, "DFDS Seaways", 4000);
	 	fieldlist[26] = new Territory(27, "Bredgade", 5200, new int[]{450,2200,6600,16000,19500,23000}, 3, 3000, "White");
	 	fieldlist[27] = new Territory(28, "Kgs. Nytorv", 5200, new int[]{450,2200,6600,16000,19500,23000}, 3, 3000, "White");
	 	fieldlist[28] = new Brewery(29, "Coca-Cola", 3000);
	 	fieldlist[29] = new Territory(30, "Østergade", 5600, new int[]{500,2400,7200,17000,20500,24000}, 3, 3000, "White");
	 	fieldlist[30] = new Jail(31, "Jail");
	 	fieldlist[31] = new Territory(32, "Amagertorv", 6000, new int[]{550,2600,7800,18000,22000,25000}, 3, 4000, "Yellow");
	 	fieldlist[32] = new Territory(33, "Vimmelskaftet", 6000, new int[]{550,2600,7800,18000,22000,25000}, 3, 4000, "Yellow");
	 	fieldlist[33] = new TryYourLuck(34, "Try Your Luck", luckycards);
	 	fieldlist[34] = new Territory(35, "Nygade", 6400, new int[]{600,3000,9000,20000,24000,28000}, 3, 4000, "Yellow");
	 	fieldlist[35] = new Ships(36, "DSB Halsskov/Knudshoved", 4000);
	 	fieldlist[36] = new TryYourLuck(37, "Try Your Luck", luckycards);
	 	fieldlist[37] = new Territory(38, "Frederiksborggade", 7000, new int[]{700,3500,10000,22000,26000,30000}, 2, 4000, "Purple");
	 	fieldlist[38] = new Tax(39, "Statsskat", 2000);
	 	fieldlist[39] = new Territory(40, "Rådhuspladsen", 8000, new int[]{1000,4000,12000,28000,34000,40000}, 2, 4000, "Purple");
	}
	
	public String toString()
	{
		String str="";
		for (int i=0; i<fieldlist.length; i++)
		{
			str+=fieldlist[i].toString();
			str+="\n";
		}
		return str;
	}
	 
	public Field getField(int field)
	{
		return fieldlist[field-1];
	}
	
	public void putOutOfJailCardBack() {
		luckycards.putOutOfJailCardBack();
	}
	
	public List<LuckyCard> getLuckyCardList(){
		return luckycards.getCardStack();
	}
	
	public void setLuckyCardStack(ArrayList<LuckyCard> cards){
		luckycards.setCardList(cards);
	}
	 
}